﻿Imports System.ComponentModel

Public Class BackgroundReporter
    Private Shared _worker As BackgroundWorker
    Public Shared Property BackgroundWorker() As BackgroundWorker
        Get
            Return _worker
        End Get
        Set(ByVal value As BackgroundWorker)
            _worker = value
        End Set
    End Property


    Private Shared _messagePrefix As String
    Public Shared Property MessagePrefix() As String
        Get
            Return _messagePrefix
        End Get
        Set(ByVal value As String)
            _messagePrefix = value
        End Set
    End Property

    Public Shared Sub ReportProgress(ByVal messagePrefix As String, ByVal message As String)
        _messagePrefix = messagePrefix
        ReportProgress(message)
    End Sub
    Public Shared Sub ReportProgress(ByVal message As String)
        If Not _worker Is Nothing Then
            _worker.ReportProgress(0, String.Format("Processing '{0}' {1}", _messagePrefix.ToLower(), message))
        End If
    End Sub
End Class